 <template>
    <div>
     <p><span>自提点名称</span>  <el-input v-model="input" class="inp" placeholder="请输入自提点名称" />  <el-button type="primary" :icon="Search">搜索</el-button> <el-button type="info" :icon="Delete">清空</el-button></p>
    <p> <el-button type="primary" :icon="Plus" @click="dialogFormVisible = true">新增</el-button>
      <el-button type="danger" disabled>批量删除</el-button>
    </p>
    <p class="ps"><span>当前表格已选择{{seles.length}}项</span><button class="clear">清空</button></p>
     <el-dialog v-model="dialogTableVisible" title="Shipping address">
    <el-table :data="list">
      <el-table-column property="date" label="Date" width="150" />
      <el-table-column property="name" label="Name" width="200" />
      <el-table-column property="address" label="Address" />
    </el-table>
  </el-dialog>
  <el-dialog v-model="dialogFormVisible" title="新增">
    <el-form :model="form">
      <el-form-item label="名称" :label-width="formLabelWidth">
        <el-input v-model="form.name"  placeholder="自提点名称" autocomplete="off" />
      </el-form-item>
      <el-form-item label="省份" :label-width="formLabelWidth">
        <el-select v-model="form.region" placeholder="请选择">
          <el-option label="Zone No.1" value="上海" />
          <el-option label="Zone No.2" value="北京" />
        </el-select>
        <el-select v-model="form.region1" placeholder="请选择">
          <el-option label="Zone No.1" value="上海" />
          <el-option label="Zone No.2" value="北京" />
        </el-select>
        <el-select v-model="form.region2" placeholder="请选择">
          <el-option label="Zone No.1" value="上海" />
          <el-option label="Zone No.2" value="北京" />
        </el-select>
      </el-form-item>
      <el-form-item label="地址" :label-width="formLabelWidth">
        <el-input v-model="form.address" placeholder="地址" autocomplete="off" />
      </el-form-item>
      <el-form-item label="手机号" :label-width="formLabelWidth">
        <el-input v-model="form.tel" placeholder="手机号" autocomplete="off" />
      </el-form-item>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">
          确认
        </el-button>
      </span>
    </template>
  </el-dialog>

<!-- 表格 -->
<el-table  ref="multipleTableRef"
    :data="list"
    style="width: 100%"
    @selection-change="handleSelectionChange">
    <el-table-column type="selection"  align="center" width="55" />
    <el-table-column fixed prop="addrName"  align="center" label="自提点名称" width="150" />
    <el-table-column prop="mobile"  align="center" label="手机号" width="120" />
    <el-table-column prop="province"  align="center" label="省份" width="120" />
    <el-table-column prop="city" align="center" label="城市" width="120" />
    <el-table-column prop="area"  align="center" label="区/县" width="120" />
    <el-table-column prop="addr"  align="center" label="地址" width="120" />
    <el-table-column fixed="right"  align="center" label="操作" width="180">
      <template #default="scope">
        <el-button type="primary" :icon="EditPen">编辑</el-button>
        <el-button type="danger" :icon="DeleteFilled" @click="del(scope.$index)">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
    </div>
  </template>
  
  <script setup>
  import {
  Check,
  Delete,
  Edit,
  Message,
  EditPen,
  Plus,
  Search,
  Star,
  DeleteFilled
} from '@element-plus/icons-vue'
  import { ref,reactive, onMounted } from 'vue'
  import {ziti} from '@/api/index'
  const input = ref('')
  const dialogTableVisible = ref(false)
const dialogFormVisible = ref(false)
const formLabelWidth = '140px'
const list=ref([])
onMounted(async ()=>{
  const res=await ziti()
  console.log(res);
  list.value=res.data.records
  console.log(list);
})

const seles=ref([])
const handleSelectionChange=(val)=> {
   seles.value=val
    }

const form = reactive({
  name: '',
  region: '',
  date1: '',
  date2: '',
  delivery: false,
  type: [],
  resource: '',
  address:'',
  desc: '',
  tel:''
})

const del=(res)=>{
 list.value.splice(res,1)
}


  </script>
  
  <style scoped>
  .inp{
    width: 200px;
  }
  .ps{
    width: 200px;
    height: 35px;
text-align: center;
line-height: 35px;
color: #02a1e9;
    background: rgba(2,161,233,.1)
  }
  .clear{
    background: rgba(2,161,233,.1);
    color: #02a1e9;
    border: none;
    margin-left: 15px;
  }
  </style>